#ifndef __SERVERFUNC_H__
#define __SERVERFUNC_H__

typedef struct userdatatcp
{
	int code;
	char username[32];
	char password[32];
	char name[32];
	char time[128];
	char text[256];
}tcpsock;

typedef struct linknode
{
	char name[32];
	char time[128];
	char text[256];
	struct linknode *next;
}link_node;

typedef struct userdata
{
	char username[32];
	char password[32];
	struct userdata *next;
}user_data;

typedef struct usermes
{
	int code;
	char name[32];
	char time[128];
	char text[256];
}user_mes;

link_node *H;
user_data *h;
void *acceptpthread(void *arg);
link_node *creat(void);
int headinsert(link_node *H,tcpsock recvdata);
user_data *creatuserlink(void);
int userinsert(user_data *H,tcpsock recvdata);
int login(user_data *H,tcpsock recvdata);
int viewuser(user_data *H,int acceptfd);
int usermessage(link_node *H,int acceptfd);
int viewallmessage(link_node *H,int acceptfd);


#endif
